package com.xc.tjise.TJISE.day10;

public class MT3 implements Runnable {
    public static void main(String[] args) {
        Thread thread = new Thread(new MT3());
        thread.setName("thread");
        thread.start();

        try {
            thread.join();  // join 最后执行

        } catch (InterruptedException e){
           throw new RuntimeException(e);
        }

//        try {
//            Thread.sleep(1);
//        }catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        }
        System.out.println("test");
    }

    @Override
    public void run() {
        for (int i = 0; i < 3; i++) {
            System.out.println(Thread.currentThread().getName() + "is running...");
        }
        try {
            Thread.sleep(3000);
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
